package com.boxfishedu.foreignkey.service;

import com.boxfishedu.foreignkey.entity.Teacher;
import com.boxfishedu.foreignkey.entity.jpa.TeacherJpaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by lzx on 16/3/9.
 */
@Service
public class TeacherService {

    @Autowired
    private TeacherJpaRepository teacherJpaRepository;

    public Teacher save(Teacher teacher) {
        return teacherJpaRepository.save(teacher);
    }

    public Teacher save(String username, String password) {
        Teacher teacher = new Teacher();
        teacher.setUsername(username);
        teacher.setPassword(password);
        return save(teacher);
    }
}
